package com.ravi.controller;

import com.github.pagehelper.PageInfo;
import com.ravi.model.dto.CheckRoomDto;
import com.ravi.model.query.CommonPageReq;
import com.ravi.model.resp.R;
import com.ravi.model.vo.CheckRoomVo;
import com.ravi.service.intf.CheckRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CheckRoomController {

	@Autowired
	private CheckRoomService checkRoomService;

	@PostMapping("/checkroom/all")
	public R getRoomInfoVoPage(@RequestBody CommonPageReq commonPageReq) {
		PageInfo<CheckRoomVo> pageInfo = checkRoomService.listRoomVoPage(commonPageReq.getPageNum(), commonPageReq.getPageSize());
		return R.ok().put("pageInfo", pageInfo);
	}

	@GetMapping("/checkroom/getall")
	public R getAllRoomInfo() {
		List<CheckRoomVo> rooms = checkRoomService.getAll();
		return R.ok().put("rooms", rooms);
	}
}
